package com.cloud.sample.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.cloud.common.bean.PageInfo;
import com.cloud.sample.cache.UserCache;
import com.cloud.sample.dao.UserDao;
import com.cloud.sample.dto.UserQueryParamDTO;
import com.cloud.sample.entity.User;
import com.cloud.sample.service.UserService;
import lombok.Setter;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * 用户服务实现类
 *
 * @author feng
 * @since 2022/05/17
 */
@Slf4j
@Setter
@Service
public class UserServiceImpl extends ServiceImpl<UserDao, User> implements UserService {

    @Autowired
    private UserCache userCache;

    @Override
    public PageInfo<User> query(UserQueryParamDTO paramDTO) {
        QueryWrapper<User> wrapper = new QueryWrapper<>();
        IPage page = page(new Page(paramDTO.getPageNo(), paramDTO.getPageSize()), wrapper);
        return new PageInfo(page);
    }
}